/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entitybean;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Admin
 */
@Entity
@Table(name = "permision", catalog = "OnlineShopFourDVD", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "Permision.findAll", query = "SELECT p FROM Permision p"),
    @NamedQuery(name = "Permision.findByPermisionId", query = "SELECT p FROM Permision p WHERE p.permisionId = :permisionId"),
    @NamedQuery(name = "Permision.findByPermisionName", query = "SELECT p FROM Permision p WHERE p.permisionName = :permisionName")})
public class Permision implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "permision_id", nullable = false)
    private Integer permisionId;
    @Column(name = "permision_name", length = 50)
    private String permisionName;
    @ManyToMany(mappedBy = "permisionCollection")
    private Collection<Admin> adminCollection;

    public Permision() {
    }

    public Permision(Integer permisionId) {
        this.permisionId = permisionId;
    }

    public Integer getPermisionId() {
        return permisionId;
    }

    public void setPermisionId(Integer permisionId) {
        this.permisionId = permisionId;
    }

    public String getPermisionName() {
        return permisionName;
    }

    public void setPermisionName(String permisionName) {
        this.permisionName = permisionName;
    }

    public Collection<Admin> getAdminCollection() {
        return adminCollection;
    }

    public void setAdminCollection(Collection<Admin> adminCollection) {
        this.adminCollection = adminCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (permisionId != null ? permisionId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Permision)) {
            return false;
        }
        Permision other = (Permision) object;
        if ((this.permisionId == null && other.permisionId != null) || (this.permisionId != null && !this.permisionId.equals(other.permisionId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entitybean.Permision[permisionId=" + permisionId + "]";
    }

}
